package com.jt.model;

/**
 * Created by he on 2015/9/12.
 */
public class Rental {

    private Movie movie;
    private int days;

    public Rental(Movie movie, int days) {
        this.movie = movie;
        this.days = days;
    }

    public Movie getMovie() {
        return movie;
    }

    public int getDays() {
        return days;
    }

    public double getAmount() {
        double thisAmount = 0.0;
        switch (getMovie().getType()) {
            case Movie.new_release:
                thisAmount += 3.0;
                if (getDays() > 2) {
                    thisAmount -= 1.0;
                }
                break;
            case Movie.common:
                thisAmount += 2.0;
                break;
            case Movie.child:
                thisAmount += 1.0;
                break;

        }
        return thisAmount;
    }

    public int getPoint() {
        if (getDays() > 2) {
            return 2;
        }
        return 1;
    }
}
